// Created Time:    2019-04-17 13:46:44
// Modified Time:   2019-04-18 14:54:50

#include "stdrope.h"
#include "util.h"

#include "hallib.h"
#include "sallib.h"
#include "ostime.h"
#include "ostmr.h"
#include "log.h"
#include "uart.h"

void TMR_Test(void *arg)
{
    LOG_INF("MAIN", "###### Timer Call #####\n");
}

int main(int argc, char *argv[]) 
{
    uint32_t uiCnt = 0;
    hd_t hUart = NULL;
    osTimerId_t pTmr = NULL;
    osTimerAttr_t stTimerAttr = {.name = "test_timer"};

    SAL_PreInstall();
    HAL_Install();
    SAL_MainInstall();

    hUart = HAL_Open(HW_UART, HAL_UART0);
    HAL_Close(hUart);
    pTmr = osTimerNew(TMR_Test, osTimerPeriodic, NULL, &stTimerAttr);
    osTimerStart(pTmr, 500);
    while (1)
    {
        uiCnt++;
        LOG_DBG("MAIN", "========= %d =========\n", uiCnt);
        osSleep(1);
        LOG_Flush(0);
    }
    return 0;
}

